﻿using DevExpress.XtraGrid.Views.BandedGrid;
using DLL;
using NursingFormSystem.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace NursingFormSystem.NursingSurgery
{
    public partial class HistorySurgery : Form
    {
        #region 变量声明
        public NursingFormSystem.NurFormsService.NursingForm formService = new NursingFormSystem.NurFormsService.NursingForm();
        Tb_User LoginUser;
        PatientInfo Patientinfo;
        #endregion
        public HistorySurgery(Tb_User loginUser, PatientInfo patientInfo)
        {
            InitializeComponent();
            LoginUser = loginUser;
            this.Patientinfo = patientInfo;
            SetBandGridView();
            BindInfo();
        }

        private void BindInfo()
        {
            string patientid = Patientinfo.PATIENT_ID;//住院号
            int VisitId = Patientinfo.VISIT_ID;//住院次数
            int FormId = (int)FormType.SheetSafeChkRecord;//17001  //表单ID
            DataTable dt = new DataTable();
            #region 创建列头
            dt.Columns.Add("nishoushu", typeof(string));
            dt.Columns.Add("czqjiankangjiaoyu1", typeof(string));
            dt.Columns.Add("czqjiankangjiaoyu2", typeof(string));
            dt.Columns.Add("yishi1", typeof(string));
            dt.Columns.Add("yishi2", typeof(string));
            dt.Columns.Add("yishi3", typeof(string));
            dt.Columns.Add("yishi4", typeof(string));
            dt.Columns.Add("wandai1", typeof(string));
            dt.Columns.Add("wandai2", typeof(string));
            dt.Columns.Add("yaoquguomin1", typeof(string));
            dt.Columns.Add("yaoquguomin2", typeof(string));
            dt.Columns.Add("yaoquguomin3", typeof(string));
            dt.Columns.Add("pifuzhunbei1", typeof(string));
            dt.Columns.Add("pifuzhunbei2", typeof(string));
            dt.Columns.Add("jiaochapeixue1", typeof(string));
            dt.Columns.Add("jiaochapeixue2", typeof(string));
            dt.Columns.Add("pifuqingkuang1", typeof(string));
            dt.Columns.Add("pifuqingkuang2", typeof(string));
            dt.Columns.Add("pifuqingkuang3", typeof(string));
            dt.Columns.Add("pifuqingkuang4", typeof(string));
            dt.Columns.Add("tengtong1", typeof(string));
            dt.Columns.Add("tengtong2", typeof(string));
            dt.Columns.Add("tengtong3", typeof(string));
            dt.Columns.Add("tengtong4", typeof(string));
            dt.Columns.Add("shengmingtiwen", typeof(string));
            dt.Columns.Add("shengmingmaibo", typeof(string));
            dt.Columns.Add("shengminghuxi", typeof(string));
            dt.Columns.Add("shengmingxueya1", typeof(string));
            dt.Columns.Add("shengmingxueya2", typeof(string));
            dt.Columns.Add("shengmingtizhong", typeof(string));
            dt.Columns.Add("jingmaitonglu1", typeof(string));
            dt.Columns.Add("jingmaitonglu2", typeof(string));
            dt.Columns.Add("jingmaitonglu3", typeof(string));
            dt.Columns.Add("jingmaitonglu4", typeof(string));
            dt.Columns.Add("jingmaitonglu5", typeof(string));
            dt.Columns.Add("jingmaitonglu6", typeof(string));
            dt.Columns.Add("liuzhidaoniaoguan1", typeof(string));
            dt.Columns.Add("liuzhidaoniaoguan2", typeof(string));
            dt.Columns.Add("liuzhidaoniaoguan3", typeof(string));
            dt.Columns.Add("liuzhiweiguan1", typeof(string));
            dt.Columns.Add("liuzhiweiguan2", typeof(string));
            dt.Columns.Add("yinliuguan1", typeof(string));
            dt.Columns.Add("yinliuguan2", typeof(string));
            dt.Columns.Add("yinliuguan3", typeof(string));
            dt.Columns.Add("caozuoqianbiaoji1", typeof(string));
            dt.Columns.Add("caozuoqianbiaoji2", typeof(string));
            dt.Columns.Add("caozuoqianyongyao1", typeof(string));
            dt.Columns.Add("caozuoqianyongyao2", typeof(string));
            dt.Columns.Add("dairuyaowu", typeof(string));
            dt.Columns.Add("dairuwupin1", typeof(string));
            dt.Columns.Add("dairuwupin2", typeof(string));
            dt.Columns.Add("dairuwupin3", typeof(string));
            dt.Columns.Add("dairuwupin4", typeof(string));
            dt.Columns.Add("dairuwupin5", typeof(string));
            dt.Columns.Add("dairuwupin6", typeof(string));
            dt.Columns.Add("dairuwupin7", typeof(string));
            dt.Columns.Add("jiaojieshijian", typeof(string));
            dt.Columns.Add("jiaobanhushi", typeof(string));
            dt.Columns.Add("jiebanhushi", typeof(string));
            dt.Columns.Add("raoxingjizhen", typeof(string));
            dt.Columns.Add("zhenjingzhiqing1", typeof(string));
            dt.Columns.Add("zhenjingzhiqing2", typeof(string));
            dt.Columns.Add("zhenjingzhiqing3", typeof(string));
            dt.Columns.Add("zhenjingyongyao1", typeof(string));
            dt.Columns.Add("zhenjingyongyao2", typeof(string));
            dt.Columns.Add("zhenjingyongyao3", typeof(string));
            dt.Columns.Add("zhiqingtongyi1", typeof(string));
            dt.Columns.Add("zhiqingtongyi2", typeof(string));
            dt.Columns.Add("zhiqingtongyi", typeof(string));
            dt.Columns.Add("czqzhunbei1", typeof(string));
            dt.Columns.Add("czqzhunbei2", typeof(string));
            dt.Columns.Add("czqzhunbei3", typeof(string));
            dt.Columns.Add("suoxuyaopin1", typeof(string));
            dt.Columns.Add("suoxuyaopin2", typeof(string));
            dt.Columns.Add("suoxuyaopin3", typeof(string));
            dt.Columns.Add("teshuhaocai1", typeof(string));
            dt.Columns.Add("teshuhaocai2", typeof(string));
            dt.Columns.Add("teshuhaocai3", typeof(string));
            dt.Columns.Add("teshuhaocai4", typeof(string));
            dt.Columns.Add("teshuhaocai5", typeof(string));
            dt.Columns.Add("brsfsbhd1", typeof(string));
            dt.Columns.Add("brsfsbhd2", typeof(string));
            dt.Columns.Add("brxmzq1", typeof(string));
            dt.Columns.Add("brxmzq2", typeof(string));
            dt.Columns.Add("brxmzq3", typeof(string));
            dt.Columns.Add("zhuyuanhao1", typeof(string));
            dt.Columns.Add("zhuyuanhao2", typeof(string));
            dt.Columns.Add("zhuyuanhao3", typeof(string));
            dt.Columns.Add("czmczq1", typeof(string));
            dt.Columns.Add("czmczq2", typeof(string));
            dt.Columns.Add("czmczq3", typeof(string));
            dt.Columns.Add("shoushubuwei1", typeof(string));
            dt.Columns.Add("shoushubuwei2", typeof(string));
            dt.Columns.Add("shoushubuwei3", typeof(string));
            dt.Columns.Add("caozuobuwei", typeof(string));
            dt.Columns.Add("caozuotiwei1", typeof(string));
            dt.Columns.Add("caozuotiwei2", typeof(string));
            dt.Columns.Add("caozuotiwei3", typeof(string));
            dt.Columns.Add("caozuotiwei4", typeof(string));
            dt.Columns.Add("caozuokaishishijian", typeof(string));
            dt.Columns.Add("heduizheyishi", typeof(string));
            dt.Columns.Add("heduizhemazui", typeof(string));
            dt.Columns.Add("heduizhehushi", typeof(string));
            dt.Columns.Add("zaoyingji1", typeof(string));
            dt.Columns.Add("zaoyingji2", typeof(string));
            dt.Columns.Add("zaoyingji3", typeof(string));
            dt.Columns.Add("zaoyingji4", typeof(string));
            dt.Columns.Add("zaoyingji5", typeof(string));
            dt.Columns.Add("shijian1", typeof(string));
            dt.Columns.Add("xueya1", typeof(string));
            dt.Columns.Add("xinlv1", typeof(string));
            dt.Columns.Add("huxi1", typeof(string));
            dt.Columns.Add("caozuozhongyongyao", typeof(string));
            dt.Columns.Add("bingqingjilu", typeof(string));
            dt.Columns.Add("hushi", typeof(string));
            dt.Columns.Add("caozuojieshushijian", typeof(string));
            dt.Columns.Add("czzlzbb1", typeof(string));
            dt.Columns.Add("czzlzbb2", typeof(string));
            dt.Columns.Add("czzlzbb3", typeof(string));
            dt.Columns.Add("shijishoushu", typeof(string));
            dt.Columns.Add("zhixingshijian", typeof(string));
            dt.Columns.Add("yishuxie1", typeof(string));
            dt.Columns.Add("yishuxie2", typeof(string));
            dt.Columns.Add("yishuxie3", typeof(string));
            dt.Columns.Add("yiqingdian1", typeof(string));
            dt.Columns.Add("yiqingdian2", typeof(string));
            dt.Columns.Add("yiqingdian3", typeof(string));
            dt.Columns.Add("querenshou1", typeof(string));
            dt.Columns.Add("querenshou2", typeof(string));
            dt.Columns.Add("querenshou3", typeof(string));
            dt.Columns.Add("jiancha1", typeof(string));
            dt.Columns.Add("jiancha2", typeof(string));
            dt.Columns.Add("jiancha3", typeof(string));
            dt.Columns.Add("yishi", typeof(string));
            dt.Columns.Add("mazui", typeof(string));
            dt.Columns.Add("hushi2", typeof(string));
            dt.Columns.Add("czzyzfs1", typeof(string));
            dt.Columns.Add("czzyzfs2", typeof(string));
            dt.Columns.Add("czzyzfs3", typeof(string));
            dt.Columns.Add("yishizhuangtai1", typeof(string));
            dt.Columns.Add("yishizhuangtai2", typeof(string));
            dt.Columns.Add("yishizhuangtai3", typeof(string));
            dt.Columns.Add("yishizhuangtai4", typeof(string));
            dt.Columns.Add("yishizhuangtai5", typeof(string));
            dt.Columns.Add("czhpifuqingkuang1", typeof(string));
            dt.Columns.Add("czhpifuqingkuang2", typeof(string));
            dt.Columns.Add("czhpifuqingkuang3", typeof(string));
            dt.Columns.Add("czhpifuqingkuang4", typeof(string));
            dt.Columns.Add("czhjingmaitonglu1", typeof(string));
            dt.Columns.Add("czhjingmaitonglu2", typeof(string));
            dt.Columns.Add("czhjingmaitonglu3", typeof(string));
            dt.Columns.Add("czhjingmaitonglu4", typeof(string));
            dt.Columns.Add("czhjingmaitonglu5", typeof(string));
            dt.Columns.Add("czhjingmaitonglu6", typeof(string));
            dt.Columns.Add("czzlzylg1", typeof(string));
            dt.Columns.Add("czzlzylg2", typeof(string));
            dt.Columns.Add("czzlzylg3", typeof(string));
            dt.Columns.Add("smtzmaibo", typeof(string));
            dt.Columns.Add("smtzhuxi", typeof(string));
            dt.Columns.Add("smtzxueya1", typeof(string));
            dt.Columns.Add("smtzxueya2", typeof(string));
            dt.Columns.Add("czhtt1", typeof(string));
            dt.Columns.Add("czhtt2", typeof(string));
            dt.Columns.Add("czhtt3", typeof(string));
            dt.Columns.Add("czhtt4", typeof(string));
            dt.Columns.Add("daihuiyaopin", typeof(string));
            dt.Columns.Add("daihuiwupin1", typeof(string));
            dt.Columns.Add("daihuiwupin2", typeof(string));
            dt.Columns.Add("daihuiwupin3", typeof(string));
            dt.Columns.Add("daihuiwupin4", typeof(string));
            dt.Columns.Add("daihuiwupin5", typeof(string));
            dt.Columns.Add("daihuiwupin6", typeof(string));
            dt.Columns.Add("daihuiwupin7", typeof(string));
            dt.Columns.Add("huanzheqx1", typeof(string));
            dt.Columns.Add("huanzheqx2", typeof(string));
            dt.Columns.Add("huanzheqx3", typeof(string));
            dt.Columns.Add("huanzheqx4", typeof(string));
            dt.Columns.Add("huanzheqx5", typeof(string));
            dt.Columns.Add("huanzheqx6", typeof(string));
            dt.Columns.Add("huanzheqx7", typeof(string));
            dt.Columns.Add("czhjiaojieshijian", typeof(string));
            dt.Columns.Add("czhjiaobanhushi", typeof(string));
            dt.Columns.Add("czhjiebanhushi", typeof(string));
            dt.Columns.Add("MZHFS_YunZhuanFangShi_CheChuang", typeof(string));
            dt.Columns.Add("MZHFS_YunZhuanFangShi_LunYi", typeof(string));
            dt.Columns.Add("MZHFS_YunZhuanFangShi_BuXing", typeof(string));
            dt.Columns.Add("MZHFS_YiShiZhuangTai_QingXing", typeof(string));
            dt.Columns.Add("MZHFS_YiShiZhuangTai_ShiShui", typeof(string));
            dt.Columns.Add("MZHFS_YiShiZhuangTai_QianHunMi", typeof(string));
            dt.Columns.Add("MZHFS_YiShiZhuangTai_ShenHunMi", typeof(string));
            dt.Columns.Add("MZHFS_YiShiZhuangTai_MaZuiWeiXing", typeof(string));
            dt.Columns.Add("MZHFS_PiFuQingKuang_WanHao", typeof(string));
            dt.Columns.Add("MZHFS_PiFuQingKuang_YaHong", typeof(string));
            dt.Columns.Add("MZHFS_PiFuQingKuang_PoKui", typeof(string));
            dt.Columns.Add("MZHFS_PiFuQingKuang_BuWei", typeof(string));
            dt.Columns.Add("MZHFS_JingMaiTongLu_WaiZhouJingMaiChuanCi", typeof(string));
            dt.Columns.Add("MZHFS_JingMaiTongLu_CVC", typeof(string));
            dt.Columns.Add("MZHFS_JingMaiTongLu_PICC", typeof(string));
            dt.Columns.Add("MZHFS_JingMaiTongLu_ShuYeGang", typeof(string));
            dt.Columns.Add("MZHFS_JingMaiTongLu_Wu", typeof(string));
            dt.Columns.Add("MZHFS_JingMaiTongLu_BuWei", typeof(string));
            dt.Columns.Add("MZHFS_CaoZuoZhongLiuZhiYinLiuGuan_Wu", typeof(string));
            dt.Columns.Add("MZHFS_CaoZuoZhongLiuZhiYinLiuGuan_You", typeof(string));
            dt.Columns.Add("MZHFS_CaoZuoZhongLiuZhiYinLiuGuan_WeiZhi", typeof(string));
            dt.Columns.Add("MZHFS_ShengMingTiZheng_MaiBo", typeof(string));
            dt.Columns.Add("MZHFS_ShengMingTiZheng_HuXi", typeof(string));
            dt.Columns.Add("MZHFS_ShengMingTiZheng_XueYa1", typeof(string));
            dt.Columns.Add("MZHFS_ShengMingTiZheng_XueYa2", typeof(string));
            dt.Columns.Add("MZHFS_TengTongPingFen", typeof(string));
            dt.Columns.Add("MZHFS_DaiHuiYaoPin", typeof(string));
            dt.Columns.Add("MZHFS_DaiHuiWuPin_BingLi", typeof(string));
            dt.Columns.Add("MZHFS_DaiHuiWuPin_X_Ray", typeof(string));
            dt.Columns.Add("MZHFS_DaiHuiWuPin_CT", typeof(string));
            dt.Columns.Add("MZHFS_DaiHuiWuPin__PET_CT", typeof(string));
            dt.Columns.Add("MZHFS_DaiHuiWuPin_MR", typeof(string));
            dt.Columns.Add("MZHFS_DaiHuiWuPin_Wu", typeof(string));
            dt.Columns.Add("MZHFS_DaiHuiWuPin_QiTa", typeof(string));
            dt.Columns.Add("MZHFS_HuanZheQuXiang_BingFang", typeof(string));
            dt.Columns.Add("MZHFS_HuanZheQuXiang_ICU", typeof(string));
            dt.Columns.Add("MZHFS_HuanZheQuXiang_CCU", typeof(string));
            dt.Columns.Add("MZHFS_HuanZheQuXiang_CSICU", typeof(string));
            dt.Columns.Add("MZHFS_HuanZheQuXiang_MaZuiHuiFuShi", typeof(string));
            dt.Columns.Add("MZHFS_HuanZheQuXiang_ZiDongChuYuan", typeof(string));
            dt.Columns.Add("MZHFS_HuanZheQuXiang_SiWang", typeof(string));
            dt.Columns.Add("MZHFS_HuanZheQuXiang_JiaoJieShiJian", typeof(string));
            dt.Columns.Add("MZHFS_HuanZheQuXiang_JiaoBanHuShi", typeof(string));
            dt.Columns.Add("MZHFS_HuanZheQuXiang_JieBanHuShi", typeof(string));
            dt.Columns.Add("riqi", typeof(string));
            dt.Columns.Add("Id", typeof(string));
            #endregion
            var ret = formService.GetNursingFormRecordByDate(patientid, VisitId, FormId, this.StatDate.DateTime, this.EndDate.DateTime);
            if (ret.Code == 1)
            {
                string theTrue = "√";
                List<NursingFormRecord> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<NursingFormRecord>>(ret.D);
                list = list.OrderByDescending(p => p.AssessmentDate).ToList();
                foreach (NursingFormRecord record in list)
                {
                    var NursingFormData = record.NursingFormData;
                    OperationNote fd = new OperationNote();
                    fd = XmlUtil.XMLToObject<OperationNote>(NursingFormData, Encoding.UTF8);
                    DataRow newRow = dt.NewRow();
                    #region DataRow赋值
                    newRow["nishoushu"] = fd.NiShouShuMingCheng;
                    newRow["riqi"] = fd.RiQi;
                    newRow["czqjiankangjiaoyu1"] = fd.CaoZuoQianZhunBeiYuJiaoJie.CaoZuoQianJianKangJiaoYu.Equals("0") ? theTrue : string.Empty;
                    newRow["czqjiankangjiaoyu2"] = fd.CaoZuoQianZhunBeiYuJiaoJie.CaoZuoQianJianKangJiaoYu.Equals("1") ? theTrue : string.Empty;
                    newRow["yishi1"] = fd.CaoZuoQianZhunBeiYuJiaoJie.YiShi.Equals("0") ? theTrue : string.Empty;
                    newRow["yishi2"] = fd.CaoZuoQianZhunBeiYuJiaoJie.YiShi.Equals("1") ? theTrue : string.Empty;
                    newRow["yishi3"] = fd.CaoZuoQianZhunBeiYuJiaoJie.YiShi.Equals("2") ? theTrue : string.Empty;
                    newRow["yishi4"] = fd.CaoZuoQianZhunBeiYuJiaoJie.YiShi.Equals("3") ? theTrue : string.Empty;
                    newRow["wandai1"] = fd.CaoZuoQianZhunBeiYuJiaoJie.WanDai.Equals("0") ? theTrue : string.Empty;
                    newRow["wandai2"] = fd.CaoZuoQianZhunBeiYuJiaoJie.WanDai.Equals("1") ? theTrue : string.Empty;
                    newRow["yaoquguomin1"] = fd.CaoZuoQianZhunBeiYuJiaoJie.YaoWuGuoMin.Equals("1") ? theTrue : string.Empty;
                    newRow["yaoquguomin2"] = fd.CaoZuoQianZhunBeiYuJiaoJie.YaoWuGuoMin.Equals("0") ? theTrue : string.Empty;
                    newRow["yaoquguomin3"] = fd.CaoZuoQianZhunBeiYuJiaoJie.YaoWuGuoMinWenBenKuang;
                    newRow["pifuzhunbei1"] = fd.CaoZuoQianZhunBeiYuJiaoJie.PiFuZhunBei.Equals("0") ? theTrue : string.Empty;
                    newRow["pifuzhunbei2"] = fd.CaoZuoQianZhunBeiYuJiaoJie.PiFuZhunBei.Equals("1") ? theTrue : string.Empty;
                    newRow["jiaochapeixue1"] = fd.CaoZuoQianZhunBeiYuJiaoJie.JiaoChaPeiXue.Equals("0") ? theTrue : string.Empty;
                    newRow["jiaochapeixue2"] = fd.CaoZuoQianZhunBeiYuJiaoJie.JiaoChaPeiXue.Equals("1") ? theTrue : string.Empty;
                    newRow["pifuqingkuang1"] = fd.CaoZuoQianZhunBeiYuJiaoJie.PiFuQingKuang.Split('#')[0].Equals("1") ? theTrue : string.Empty;
                    newRow["pifuqingkuang2"] = fd.CaoZuoQianZhunBeiYuJiaoJie.PiFuQingKuang.Split('#')[1].Equals("1") ? theTrue : string.Empty;
                    newRow["pifuqingkuang3"] = fd.CaoZuoQianZhunBeiYuJiaoJie.PiFuQingKuang.Split('#')[2].Equals("1") ? theTrue : string.Empty;
                    newRow["pifuqingkuang4"] = fd.CaoZuoQianZhunBeiYuJiaoJie.PiFuQingKuangBuWei;
                    newRow["tengtong1"] = fd.CaoZuoQianZhunBeiYuJiaoJie.TengTong.Equals("0") ? theTrue : string.Empty;
                    newRow["tengtong2"] = fd.CaoZuoQianZhunBeiYuJiaoJie.TengTong.Equals("1") ? theTrue : string.Empty;
                    newRow["tengtong3"] = fd.CaoZuoQianZhunBeiYuJiaoJie.TengTongBuWei;
                    newRow["tengtong4"] = fd.CaoZuoQianZhunBeiYuJiaoJie.TengTongFenZhi;
                    newRow["shengmingtiwen"] = fd.CaoZuoQianZhunBeiYuJiaoJie.ShengMingTiZhengTiWen;
                    newRow["shengmingmaibo"] = fd.CaoZuoQianZhunBeiYuJiaoJie.ShengMingTiZhengMaiBo;
                    newRow["shengminghuxi"] = fd.CaoZuoQianZhunBeiYuJiaoJie.ShengMingTiZhengHuXi;
                    newRow["shengmingxueya1"] = fd.CaoZuoQianZhunBeiYuJiaoJie.ShengMingTiZhengXueYa1;
                    newRow["shengmingxueya2"] = fd.CaoZuoQianZhunBeiYuJiaoJie.ShengMingTiZhengXueYa2;
                    newRow["shengmingtizhong"] = fd.CaoZuoQianZhunBeiYuJiaoJie.ShengMingTiZhengTiZhong;
                    newRow["jingmaitonglu1"] = fd.CaoZuoQianZhunBeiYuJiaoJie.JingMaiTongLu.Split('#')[0].Equals("1") ? theTrue : string.Empty;
                    newRow["jingmaitonglu2"] = fd.CaoZuoQianZhunBeiYuJiaoJie.JingMaiTongLu.Split('#')[1].Equals("1") ? theTrue : string.Empty;
                    newRow["jingmaitonglu3"] = fd.CaoZuoQianZhunBeiYuJiaoJie.JingMaiTongLu.Split('#')[2].Equals("1") ? theTrue : string.Empty;
                    newRow["jingmaitonglu4"] = fd.CaoZuoQianZhunBeiYuJiaoJie.JingMaiTongLu.Split('#')[3].Equals("1") ? theTrue : string.Empty;
                    newRow["jingmaitonglu5"] = fd.CaoZuoQianZhunBeiYuJiaoJie.JingMaiTongLu.Split('#')[4].Equals("1") ? theTrue : string.Empty;
                    newRow["jingmaitonglu6"] = fd.CaoZuoQianZhunBeiYuJiaoJie.JingMaiTongLuBuWei;
                    newRow["liuzhidaoniaoguan1"] = fd.CaoZuoQianZhunBeiYuJiaoJie.LiuZhiDaoNiaoGuan.Equals("0") ? theTrue : string.Empty;
                    newRow["liuzhidaoniaoguan2"] = fd.CaoZuoQianZhunBeiYuJiaoJie.LiuZhiDaoNiaoGuan.Equals("1") ? theTrue : string.Empty;
                    newRow["liuzhidaoniaoguan3"] = fd.CaoZuoQianZhunBeiYuJiaoJie.LiuZhiDaoNiaoGuan.Equals("2") ? theTrue : string.Empty;
                    newRow["liuzhiweiguan1"] = fd.CaoZuoQianZhunBeiYuJiaoJie.LiuZhiWeiGuan.Equals("1") ? theTrue : string.Empty;
                    newRow["liuzhiweiguan2"] = fd.CaoZuoQianZhunBeiYuJiaoJie.LiuZhiWeiGuan.Equals("0") ? theTrue : string.Empty;
                    newRow["yinliuguan1"] = fd.CaoZuoQianZhunBeiYuJiaoJie.YinLiuGuan.Equals("1") ? theTrue : string.Empty;
                    newRow["yinliuguan2"] = fd.CaoZuoQianZhunBeiYuJiaoJie.YinLiuGuan.Equals("0") ? theTrue : string.Empty;
                    newRow["yinliuguan3"] = fd.CaoZuoQianZhunBeiYuJiaoJie.YinLiuGuanMingCheng;
                    newRow["caozuoqianbiaoji1"] = fd.CaoZuoQianZhunBeiYuJiaoJie.CaoZuoQianBiaoJi.Equals("0") ? theTrue : string.Empty;
                    newRow["caozuoqianbiaoji2"] = fd.CaoZuoQianZhunBeiYuJiaoJie.CaoZuoQianBiaoJi.Equals("1") ? theTrue : string.Empty;
                    newRow["caozuoqianyongyao1"] = fd.CaoZuoQianZhunBeiYuJiaoJie.CaoZuoQianYongYao.Equals("1") ? theTrue : string.Empty;
                    newRow["caozuoqianyongyao2"] = fd.CaoZuoQianZhunBeiYuJiaoJie.CaoZuoQianYongYao.Equals("0") ? theTrue : string.Empty;
                    newRow["dairuyaowu"] = fd.CaoZuoQianZhunBeiYuJiaoJie.DaiRuYaoWu;
                    newRow["dairuwupin1"] = fd.CaoZuoQianZhunBeiYuJiaoJie.DaiRuWuPin.Split('#')[0].Equals("1") ? theTrue : string.Empty;
                    newRow["dairuwupin2"] = fd.CaoZuoQianZhunBeiYuJiaoJie.DaiRuWuPin.Split('#')[1].Equals("1") ? theTrue : string.Empty;
                    newRow["dairuwupin3"] = fd.CaoZuoQianZhunBeiYuJiaoJie.DaiRuWuPin.Split('#')[2].Equals("1") ? theTrue : string.Empty;
                    newRow["dairuwupin4"] = fd.CaoZuoQianZhunBeiYuJiaoJie.DaiRuWuPin.Split('#')[3].Equals("1") ? theTrue : string.Empty;
                    newRow["dairuwupin5"] = fd.CaoZuoQianZhunBeiYuJiaoJie.DaiRuWuPin.Split('#')[4].Equals("1") ? theTrue : string.Empty;
                    newRow["dairuwupin6"] = fd.CaoZuoQianZhunBeiYuJiaoJie.DaiRuWuPin.Split('#')[5].Equals("1") ? theTrue : string.Empty;
                    newRow["dairuwupin7"] = fd.CaoZuoQianZhunBeiYuJiaoJie.DaiRuWuPinQiTa;
                    newRow["jiaojieshijian"] = fd.CaoZuoQianZhunBeiYuJiaoJie.JiaoJieShiJian;
                    newRow["jiaobanhushi"] = fd.CaoZuoQianZhunBeiYuJiaoJie.JiaoBanHuShi;
                    newRow["jiebanhushi"] = fd.CaoZuoQianZhunBeiYuJiaoJie.JieBanHuShi;
                    newRow["raoxingjizhen"] = fd.CaoZuoQianZhunBeiYuJiaoJie.RaoXingJiZhen.Equals("1") ? theTrue : string.Empty;
                    newRow["zhenjingzhiqing1"] = fd.CaoZuoQianZhunBeiHeDui.ZhenJingZhiQing.Equals("0") ? theTrue : string.Empty;
                    newRow["zhenjingzhiqing2"] = fd.CaoZuoQianZhunBeiHeDui.ZhenJingZhiQing.Equals("1") ? theTrue : string.Empty;
                    newRow["zhenjingzhiqing3"] = fd.CaoZuoQianZhunBeiHeDui.ZhenJingZhiQing.Equals("2") ? theTrue : string.Empty;
                    newRow["zhenjingyongyao1"] = fd.CaoZuoQianZhunBeiHeDui.ZhenJingYongYao.Equals("0") ? theTrue : string.Empty;
                    newRow["zhenjingyongyao2"] = fd.CaoZuoQianZhunBeiHeDui.ZhenJingYongYao.Equals("1") ? theTrue : string.Empty;
                    newRow["zhenjingyongyao3"] = fd.CaoZuoQianZhunBeiHeDui.ZhenJingYongYao.Equals("2") ? theTrue : string.Empty;
                    newRow["zhiqingtongyi1"] = fd.CaoZuoQianZhunBeiHeDui.ZhiQingTongYiShu.Equals("0") ? theTrue : string.Empty;
                    newRow["zhiqingtongyi2"] = fd.CaoZuoQianZhunBeiHeDui.ZhiQingTongYiShu.Equals("1") ? theTrue : string.Empty;
                    newRow["zhiqingtongyi"] = fd.CaoZuoQianZhunBeiHeDui.ZhiQingTongYiShu.Equals("2") ? theTrue : string.Empty;
                    newRow["czqzhunbei1"] = fd.CaoZuoQianZhunBeiHeDui.CaoZuoQianZhunBeiJiuXu.Equals("0") ? theTrue : string.Empty;
                    newRow["czqzhunbei2"] = fd.CaoZuoQianZhunBeiHeDui.CaoZuoQianZhunBeiJiuXu.Equals("1") ? theTrue : string.Empty;
                    newRow["czqzhunbei3"] = fd.CaoZuoQianZhunBeiHeDui.CaoZuoQianZhunBeiJiuXu.Equals("2") ? theTrue : string.Empty;
                    newRow["suoxuyaopin1"] = fd.CaoZuoQianZhunBeiHeDui.SuoXuYaoPin.Equals("0") ? theTrue : string.Empty;
                    newRow["suoxuyaopin2"] = fd.CaoZuoQianZhunBeiHeDui.SuoXuYaoPin.Equals("1") ? theTrue : string.Empty;
                    newRow["suoxuyaopin3"] = fd.CaoZuoQianZhunBeiHeDui.SuoXuYaoPin.Equals("2") ? theTrue : string.Empty;
                    newRow["teshuhaocai1"] = fd.CaoZuoQianZhunBeiHeDui.TeShuHaoCai.Equals("0") ? theTrue : string.Empty;
                    newRow["teshuhaocai2"] = fd.CaoZuoQianZhunBeiHeDui.TeShuHaoCai.Equals("1") ? theTrue : string.Empty;
                    if (!string.IsNullOrEmpty(fd.CaoZuoQianZhunBeiHeDui.MingCheng))
                    {
                        newRow["teshuhaocai3"] = fd.CaoZuoQianZhunBeiHeDui.MingCheng.Equals("0") ? theTrue : string.Empty;
                        newRow["teshuhaocai4"] = fd.CaoZuoQianZhunBeiHeDui.MingCheng.Equals("1") ? theTrue : string.Empty;
                        newRow["teshuhaocai5"] = fd.CaoZuoQianZhunBeiHeDui.MingCheng.Equals("2") ? theTrue : string.Empty;
                    }
                    newRow["brsfsbhd1"] = fd.CaoZuoQianZhunBeiHeDui.BingRenShenFenShiBieHeDui.Equals("0") ? theTrue : string.Empty;
                    newRow["brsfsbhd2"] = fd.CaoZuoQianZhunBeiHeDui.BingRenShenFenShiBieHeDui.Equals("1") ? theTrue : string.Empty;
                    newRow["brxmzq1"] = fd.CaoZuoQianZanTingHeDui.BingRenXingMing.Equals("0") ? theTrue : string.Empty;
                    newRow["brxmzq2"] = fd.CaoZuoQianZanTingHeDui.BingRenXingMing.Equals("1") ? theTrue : string.Empty;
                    newRow["brxmzq3"] = fd.CaoZuoQianZanTingHeDui.BingRenXingMing.Equals("2") ? theTrue : string.Empty;
                    newRow["zhuyuanhao1"] = fd.CaoZuoQianZanTingHeDui.ZhuYuanHao.Equals("0") ? theTrue : string.Empty;
                    newRow["zhuyuanhao2"] = fd.CaoZuoQianZanTingHeDui.ZhuYuanHao.Equals("1") ? theTrue : string.Empty;
                    newRow["zhuyuanhao3"] = fd.CaoZuoQianZanTingHeDui.ZhuYuanHao.Equals("2") ? theTrue : string.Empty;
                    newRow["czmczq1"] = fd.CaoZuoQianZanTingHeDui.CaoZuoMingCheng.Equals("0") ? theTrue : string.Empty;
                    newRow["czmczq2"] = fd.CaoZuoQianZanTingHeDui.CaoZuoMingCheng.Equals("1") ? theTrue : string.Empty;
                    newRow["czmczq3"] = fd.CaoZuoQianZanTingHeDui.CaoZuoMingCheng.Equals("2") ? theTrue : string.Empty;
                    newRow["shoushubuwei1"] = fd.CaoZuoQianZanTingHeDui.ShouShuBuWei.Equals("0") ? theTrue : string.Empty;
                    newRow["shoushubuwei2"] = fd.CaoZuoQianZanTingHeDui.ShouShuBuWei.Equals("1") ? theTrue : string.Empty;
                    newRow["shoushubuwei3"] = fd.CaoZuoQianZanTingHeDui.ShouShuBuWei.Equals("2") ? theTrue : string.Empty;
                    newRow["caozuobuwei"] = fd.CaoZuoQianZanTingHeDui.CaoZuoBuWei;
                    newRow["caozuotiwei1"] = fd.CaoZuoQianZanTingHeDui.CaoZuoTiWei.Split('#')[0].Equals("1") ? theTrue : string.Empty;
                    newRow["caozuotiwei2"] = fd.CaoZuoQianZanTingHeDui.CaoZuoTiWei.Split('#')[1].Equals("1") ? theTrue : string.Empty;
                    newRow["caozuotiwei3"] = fd.CaoZuoQianZanTingHeDui.CaoZuoTiWei.Split('#')[2].Equals("1") ? theTrue : string.Empty;
                    newRow["caozuotiwei4"] = fd.CaoZuoQianZanTingHeDui.CaoZuoTiWeiWenBenKuang;
                    newRow["caozuokaishishijian"] = fd.CaoZuoQianZanTingHeDui.CaoZuoKaiShiShiJian;
                    newRow["heduizheyishi"] = fd.CaoZuoQianZhunBeiHeDui.YiShi;
                    newRow["heduizhemazui"] = fd.CaoZuoQianZhunBeiHeDui.MaZui;
                    newRow["heduizhehushi"] = fd.CaoZuoQianZhunBeiHeDui.HuShi;
                    newRow["zaoyingji1"] = fd.CaoZuoZhongGuanChaJiLu.ZaoYingJi.Split('#')[0].Equals("1") ? theTrue : string.Empty;
                    newRow["zaoyingji2"] = fd.CaoZuoZhongGuanChaJiLu.ZaoYingJi.Split('#')[1].Equals("1") ? theTrue : string.Empty;
                    newRow["zaoyingji3"] = fd.CaoZuoZhongGuanChaJiLu.ZaoYingJi.Split('#')[2].Equals("1") ? theTrue : string.Empty;
                    newRow["zaoyingji4"] = fd.CaoZuoZhongGuanChaJiLu.ZaoYingJi.Split('#')[3].Equals("1") ? theTrue : string.Empty;
                    newRow["zaoyingji5"] = fd.CaoZuoZhongGuanChaJiLu.ZaoYingJiQiTa;
                    newRow["shijian1"] = fd.CaoZuoZhongGuanChaJiLu.ShiJian1;
                    newRow["xueya1"] = fd.CaoZuoZhongGuanChaJiLu.XueYa1;
                    newRow["xinlv1"] = fd.CaoZuoZhongGuanChaJiLu.XinLv1;
                    newRow["huxi1"] = fd.CaoZuoZhongGuanChaJiLu.HuXi1;
                    newRow["caozuozhongyongyao"] = fd.CaoZuoZhongGuanChaJiLu.CaoZuoZhongYongYao;
                    newRow["bingqingjilu"] = fd.CaoZuoZhongGuanChaJiLu.BingQingJiLu;
                    newRow["hushi"] = fd.CaoZuoZhongGuanChaJiLu.BingQingJiLuHuShi;
                    newRow["caozuojieshushijian"] = fd.CaoZuoZhongGuanChaJiLu.CaoZuoJieShuShiJian;
                    newRow["czzlzbb1"] = fd.CaoZuoZhongGuanChaJiLu.CaoZuoZhongLiuZhiBiaoBen.Equals("0") ? theTrue : string.Empty;
                    newRow["czzlzbb2"] = fd.CaoZuoZhongGuanChaJiLu.CaoZuoZhongLiuZhiBiaoBen.Equals("1") ? theTrue : string.Empty;
                    newRow["czzlzbb3"] = fd.CaoZuoZhongGuanChaJiLu.CaoZuoZhongLiuZhiBiaoBenGeShu;
                    newRow["shijishoushu"] = fd.CaoZuoZhongGuanChaJiLu.ShiJiShouShuMingCheng;
                    newRow["zhixingshijian"] = fd.CaoZuoZhongGuanChaJiLu.ZhiXingShiJian;
                    newRow["yishuxie1"] = fd.CaoZuoZhongGuanChaJiLu.YiShuXie.Equals("0") ? theTrue : string.Empty;
                    newRow["yishuxie2"] = fd.CaoZuoZhongGuanChaJiLu.YiShuXie.Equals("1") ? theTrue : string.Empty;
                    newRow["yishuxie3"] = fd.CaoZuoZhongGuanChaJiLu.YiShuXie.Equals("2") ? theTrue : string.Empty;
                    newRow["yiqingdian1"] = fd.CaoZuoZhongGuanChaJiLu.YiQingDian.Equals("0") ? theTrue : string.Empty;
                    newRow["yiqingdian2"] = fd.CaoZuoZhongGuanChaJiLu.YiQingDian.Equals("1") ? theTrue : string.Empty;
                    newRow["yiqingdian3"] = fd.CaoZuoZhongGuanChaJiLu.YiQingDian.Equals("2") ? theTrue : string.Empty;
                    newRow["querenshou1"] = fd.CaoZuoZhongGuanChaJiLu.QueRenShouShu.Equals("0") ? theTrue : string.Empty;
                    newRow["querenshou2"] = fd.CaoZuoZhongGuanChaJiLu.QueRenShouShu.Equals("1") ? theTrue : string.Empty;
                    newRow["querenshou3"] = fd.CaoZuoZhongGuanChaJiLu.QueRenShouShu.Equals("2") ? theTrue : string.Empty;
                    if (!string.IsNullOrEmpty(fd.CaoZuoZhongGuanChaJiLu.JianChaSheBei))
                    {
                        newRow["jiancha1"] = fd.CaoZuoZhongGuanChaJiLu.JianChaSheBei.Equals("0") ? theTrue : string.Empty;
                        newRow["jiancha2"] = fd.CaoZuoZhongGuanChaJiLu.JianChaSheBei.Equals("1") ? theTrue : string.Empty;
                        newRow["jiancha3"] = fd.CaoZuoZhongGuanChaJiLu.JianChaSheBei.Equals("2") ? theTrue : string.Empty;
                    }
                    newRow["yishi"] = fd.CaoZuoZhongGuanChaJiLu.YiShi;
                    newRow["mazui"] = fd.CaoZuoZhongGuanChaJiLu.MaZui;
                    newRow["hushi2"] = fd.CaoZuoZhongGuanChaJiLu.HuShi;
                    newRow["czzyzfs1"] = fd.CaoZuoHouJiaoJie.CaoZuoZhongYunZhuanFangShi.Split('#')[0].Equals("1") ? theTrue : string.Empty;
                    newRow["czzyzfs2"] = fd.CaoZuoHouJiaoJie.CaoZuoZhongYunZhuanFangShi.Split('#')[1].Equals("1") ? theTrue : string.Empty;
                    newRow["czzyzfs3"] = fd.CaoZuoHouJiaoJie.CaoZuoZhongYunZhuanFangShi.Split('#')[2].Equals("1") ? theTrue : string.Empty;
                    newRow["yishizhuangtai1"] = fd.CaoZuoHouJiaoJie.YiShiZhuangTai.Split('#')[0].Equals("1") ? theTrue : string.Empty;
                    newRow["yishizhuangtai2"] = fd.CaoZuoHouJiaoJie.YiShiZhuangTai.Split('#')[1].Equals("1") ? theTrue : string.Empty;
                    newRow["yishizhuangtai3"] = fd.CaoZuoHouJiaoJie.YiShiZhuangTai.Split('#')[2].Equals("1") ? theTrue : string.Empty;
                    newRow["yishizhuangtai4"] = fd.CaoZuoHouJiaoJie.YiShiZhuangTai.Split('#')[3].Equals("1") ? theTrue : string.Empty;
                    if (!string.IsNullOrEmpty(fd.CaoZuoHouJiaoJie.YiShiZhuangTai) && fd.CaoZuoHouJiaoJie.YiShiZhuangTai.Split('#').Length == 5)//字段是后面添加 所以需要此判断
                    {
                        newRow["yishizhuangtai5"] = fd.CaoZuoHouJiaoJie.YiShiZhuangTai.Split('#')[4].Equals("1") ? theTrue : string.Empty;
                    }
                    newRow["czhpifuqingkuang1"] = fd.CaoZuoHouJiaoJie.PiFuQingKuang.Split('#')[0].Equals("1") ? theTrue : string.Empty;
                    newRow["czhpifuqingkuang2"] = fd.CaoZuoHouJiaoJie.PiFuQingKuang.Split('#')[1].Equals("1") ? theTrue : string.Empty;
                    newRow["czhpifuqingkuang3"] = fd.CaoZuoHouJiaoJie.PiFuQingKuang.Split('#')[2].Equals("1") ? theTrue : string.Empty;
                    newRow["czhpifuqingkuang4"] = fd.CaoZuoHouJiaoJie.PiFuQingKuangBuWei;
                    newRow["czhjingmaitonglu1"] = fd.CaoZuoHouJiaoJie.JingMaiTongLu.Split('#')[0].Equals("1") ? theTrue : string.Empty;
                    newRow["czhjingmaitonglu2"] = fd.CaoZuoHouJiaoJie.JingMaiTongLu.Split('#')[1].Equals("1") ? theTrue : string.Empty;
                    newRow["czhjingmaitonglu3"] = fd.CaoZuoHouJiaoJie.JingMaiTongLu.Split('#')[2].Equals("1") ? theTrue : string.Empty;
                    newRow["czhjingmaitonglu4"] = fd.CaoZuoHouJiaoJie.JingMaiTongLu.Split('#')[3].Equals("1") ? theTrue : string.Empty;
                    newRow["czhjingmaitonglu5"] = fd.CaoZuoHouJiaoJie.JingMaiTongLu.Split('#')[4].Equals("1") ? theTrue : string.Empty;
                    newRow["czhjingmaitonglu6"] = fd.CaoZuoHouJiaoJie.JingMaiTongLuBuWei;
                    newRow["czzlzylg1"] = fd.CaoZuoHouJiaoJie.CaoZuoZhongLiuZhiYinLiuGuan.Equals("0") ? theTrue : string.Empty;
                    newRow["czzlzylg2"] = fd.CaoZuoHouJiaoJie.CaoZuoZhongLiuZhiYinLiuGuan.Equals("1") ? theTrue : string.Empty;
                    newRow["czzlzylg3"] = fd.CaoZuoHouJiaoJie.CaoZuoZhongLiuZhiYinLiuGuanWeiZhi;
                    newRow["smtzmaibo"] = fd.CaoZuoHouJiaoJie.ShengMingTiZhengMaiBo;
                    newRow["smtzhuxi"] = fd.CaoZuoHouJiaoJie.ShengMingTiZhengHuXi;
                    newRow["smtzxueya1"] = fd.CaoZuoHouJiaoJie.ShengMingTiZhengXueYa1;
                    newRow["smtzxueya2"] = fd.CaoZuoHouJiaoJie.ShengMingTiZhengXueYa2;
                    if (!string.IsNullOrEmpty(fd.CaoZuoHouJiaoJie.CaoZuoHouTengTong))
                    {
                        newRow["czhtt1"] = fd.CaoZuoHouJiaoJie.CaoZuoHouTengTong.Equals("1") ? theTrue : string.Empty;
                        newRow["czhtt2"] = fd.CaoZuoHouJiaoJie.CaoZuoHouTengTong.Equals("0") ? theTrue : string.Empty;
                    }
                    newRow["czhtt3"] = fd.CaoZuoHouJiaoJie.CaoZuoHouTengTongBuWei;
                    newRow["czhtt4"] = fd.CaoZuoHouJiaoJie.CaoZuoHouTengTongFenZhi;
                    newRow["daihuiyaopin"] = fd.CaoZuoHouJiaoJie.DaiHuiYaoPin;
                    newRow["daihuiwupin1"] = fd.CaoZuoHouJiaoJie.DaiHuiWuPin.Split('#')[0].Equals("1") ? theTrue : string.Empty;
                    newRow["daihuiwupin2"] = fd.CaoZuoHouJiaoJie.DaiHuiWuPin.Split('#')[1].Equals("1") ? theTrue : string.Empty;
                    newRow["daihuiwupin3"] = fd.CaoZuoHouJiaoJie.DaiHuiWuPin.Split('#')[2].Equals("1") ? theTrue : string.Empty;
                    newRow["daihuiwupin4"] = fd.CaoZuoHouJiaoJie.DaiHuiWuPin.Split('#')[3].Equals("1") ? theTrue : string.Empty;
                    newRow["daihuiwupin5"] = fd.CaoZuoHouJiaoJie.DaiHuiWuPin.Split('#')[4].Equals("1") ? theTrue : string.Empty;
                    newRow["daihuiwupin6"] = fd.CaoZuoHouJiaoJie.DaiHuiWuPin.Split('#')[5].Equals("1") ? theTrue : string.Empty;
                    newRow["daihuiwupin7"] = fd.CaoZuoHouJiaoJie.DaiHuiWuPinQiTa;
                    newRow["huanzheqx1"] = fd.CaoZuoHouJiaoJie.HuanZheQuXiang.Split('#')[0].Equals("1") ? theTrue : string.Empty;
                    newRow["huanzheqx2"] = fd.CaoZuoHouJiaoJie.HuanZheQuXiang.Split('#')[1].Equals("1") ? theTrue : string.Empty;
                    newRow["huanzheqx3"] = fd.CaoZuoHouJiaoJie.HuanZheQuXiang.Split('#')[2].Equals("1") ? theTrue : string.Empty;
                    newRow["huanzheqx4"] = fd.CaoZuoHouJiaoJie.HuanZheQuXiang.Split('#')[3].Equals("1") ? theTrue : string.Empty;
                    newRow["huanzheqx5"] = fd.CaoZuoHouJiaoJie.HuanZheQuXiang.Split('#')[4].Equals("1") ? theTrue : string.Empty;
                    newRow["huanzheqx6"] = fd.CaoZuoHouJiaoJie.HuanZheQuXiang.Split('#')[5].Equals("1") ? theTrue : string.Empty;
                    newRow["huanzheqx7"] = fd.CaoZuoHouJiaoJie.HuanZheQuXiang.Split('#')[6].Equals("1") ? theTrue : string.Empty;
                    newRow["czhjiaojieshijian"] = fd.CaoZuoHouJiaoJie.JiaoJieShiJian;
                    newRow["czhjiaobanhushi"] = fd.CaoZuoHouJiaoJie.JiaoBanHuShi;
                    newRow["czhjiebanhushi"] = fd.CaoZuoHouJiaoJie.JieBanHuShi;
                    if (string.IsNullOrEmpty(fd.MaZuiHuiFuShiJiaoJie.YunZhuanFangShi))
                        fd.MaZuiHuiFuShiJiaoJie.YunZhuanFangShi = "0#0#0";
                    newRow["MZHFS_YunZhuanFangShi_CheChuang"] = fd.MaZuiHuiFuShiJiaoJie.YunZhuanFangShi.Split('#')[0].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_YunZhuanFangShi_LunYi"] = fd.MaZuiHuiFuShiJiaoJie.YunZhuanFangShi.Split('#')[1].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_YunZhuanFangShi_BuXing"] = fd.MaZuiHuiFuShiJiaoJie.YunZhuanFangShi.Split('#')[2].Equals("1") ? theTrue : string.Empty;
                    if (string.IsNullOrEmpty(fd.MaZuiHuiFuShiJiaoJie.YiShiZhuangTai))
                        fd.MaZuiHuiFuShiJiaoJie.YiShiZhuangTai = "0#0#0#0#0";
                    newRow["MZHFS_YiShiZhuangTai_QingXing"] = fd.MaZuiHuiFuShiJiaoJie.YiShiZhuangTai.Split('#')[0].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_YiShiZhuangTai_ShiShui"] = fd.MaZuiHuiFuShiJiaoJie.YiShiZhuangTai.Split('#')[1].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_YiShiZhuangTai_QianHunMi"] = fd.MaZuiHuiFuShiJiaoJie.YiShiZhuangTai.Split('#')[2].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_YiShiZhuangTai_ShenHunMi"] = fd.MaZuiHuiFuShiJiaoJie.YiShiZhuangTai.Split('#')[3].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_YiShiZhuangTai_MaZuiWeiXing"] = fd.MaZuiHuiFuShiJiaoJie.YiShiZhuangTai.Split('#')[4].Equals("1") ? theTrue : string.Empty;
                    if (string.IsNullOrEmpty(fd.MaZuiHuiFuShiJiaoJie.PiFuQingKuang))
                        fd.MaZuiHuiFuShiJiaoJie.PiFuQingKuang = "0#0#0";
                    newRow["MZHFS_PiFuQingKuang_WanHao"] = fd.MaZuiHuiFuShiJiaoJie.PiFuQingKuang.Split('#')[0].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_PiFuQingKuang_YaHong"] = fd.MaZuiHuiFuShiJiaoJie.PiFuQingKuang.Split('#')[1].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_PiFuQingKuang_PoKui"] = fd.MaZuiHuiFuShiJiaoJie.PiFuQingKuang.Split('#')[2].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_PiFuQingKuang_BuWei"] = fd.MaZuiHuiFuShiJiaoJie.PiFuQingKuangBuWei;
                    if (string.IsNullOrEmpty(fd.MaZuiHuiFuShiJiaoJie.JingMaiTongLu))
                        fd.MaZuiHuiFuShiJiaoJie.JingMaiTongLu = "0#0#0#0#0";
                    newRow["MZHFS_JingMaiTongLu_WaiZhouJingMaiChuanCi"] = fd.MaZuiHuiFuShiJiaoJie.JingMaiTongLu.Split('#')[0].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_JingMaiTongLu_CVC"] = fd.MaZuiHuiFuShiJiaoJie.JingMaiTongLu.Split('#')[1].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_JingMaiTongLu_PICC"] = fd.MaZuiHuiFuShiJiaoJie.JingMaiTongLu.Split('#')[2].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_JingMaiTongLu_ShuYeGang"] = fd.MaZuiHuiFuShiJiaoJie.JingMaiTongLu.Split('#')[3].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_JingMaiTongLu_Wu"] = fd.MaZuiHuiFuShiJiaoJie.JingMaiTongLu.Split('#')[4].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_JingMaiTongLu_BuWei"] = fd.MaZuiHuiFuShiJiaoJie.JingMaiTongLuBuWei;
                    if (string.IsNullOrEmpty(fd.MaZuiHuiFuShiJiaoJie.CaoZuoZhongLiuZhiYinLiuGuan))
                        fd.MaZuiHuiFuShiJiaoJie.CaoZuoZhongLiuZhiYinLiuGuan = "0#0";
                    newRow["MZHFS_CaoZuoZhongLiuZhiYinLiuGuan_Wu"] = fd.MaZuiHuiFuShiJiaoJie.CaoZuoZhongLiuZhiYinLiuGuan.Equals("0") ? theTrue : string.Empty;
                    newRow["MZHFS_CaoZuoZhongLiuZhiYinLiuGuan_You"] = fd.MaZuiHuiFuShiJiaoJie.CaoZuoZhongLiuZhiYinLiuGuan.Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_CaoZuoZhongLiuZhiYinLiuGuan_WeiZhi"] = fd.MaZuiHuiFuShiJiaoJie.CaoZuoZhongLiuZhiYinLiuGuanWeiZhi;
                    newRow["MZHFS_ShengMingTiZheng_MaiBo"] = fd.MaZuiHuiFuShiJiaoJie.ShengMingTiZhengMaiBo;
                    newRow["MZHFS_ShengMingTiZheng_HuXi"] = fd.MaZuiHuiFuShiJiaoJie.ShengMingTiZhengHuXi;
                    newRow["MZHFS_ShengMingTiZheng_XueYa1"] = fd.MaZuiHuiFuShiJiaoJie.ShengMingTiZhengXueYa1;
                    newRow["MZHFS_ShengMingTiZheng_XueYa2"] = fd.MaZuiHuiFuShiJiaoJie.ShengMingTiZhengXueYa2;
                    newRow["MZHFS_TengTongPingFen"] = fd.MaZuiHuiFuShiJiaoJie.TengTongFenZhi;
                    newRow["MZHFS_DaiHuiYaoPin"] = fd.MaZuiHuiFuShiJiaoJie.DaiHuiYaoPin;
                    if (string.IsNullOrEmpty(fd.MaZuiHuiFuShiJiaoJie.DaiHuiWuPin))
                        fd.MaZuiHuiFuShiJiaoJie.DaiHuiWuPin = "0#0#0#0#0#0";
                    newRow["MZHFS_DaiHuiWuPin_BingLi"] = fd.MaZuiHuiFuShiJiaoJie.DaiHuiWuPin.Split('#')[0].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_DaiHuiWuPin_X_Ray"] = fd.MaZuiHuiFuShiJiaoJie.DaiHuiWuPin.Split('#')[1].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_DaiHuiWuPin_CT"] = fd.MaZuiHuiFuShiJiaoJie.DaiHuiWuPin.Split('#')[2].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_DaiHuiWuPin__PET_CT"] = fd.MaZuiHuiFuShiJiaoJie.DaiHuiWuPin.Split('#')[3].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_DaiHuiWuPin_MR"] = fd.MaZuiHuiFuShiJiaoJie.DaiHuiWuPin.Split('#')[4].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_DaiHuiWuPin_Wu"] = fd.MaZuiHuiFuShiJiaoJie.DaiHuiWuPin.Split('#')[5].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_DaiHuiWuPin_QiTa"] = fd.MaZuiHuiFuShiJiaoJie.DaiHuiWuPinQiTa;
                    if (string.IsNullOrEmpty(fd.MaZuiHuiFuShiJiaoJie.HuanZheQuXiang)
                        || fd.MaZuiHuiFuShiJiaoJie.HuanZheQuXiang.Split('#').Length != 7)
                        fd.MaZuiHuiFuShiJiaoJie.HuanZheQuXiang = "0#0#0#0#0#0#0";
                    newRow["MZHFS_HuanZheQuXiang_BingFang"] = fd.MaZuiHuiFuShiJiaoJie.HuanZheQuXiang.Split('#')[0].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_HuanZheQuXiang_ICU"] = fd.MaZuiHuiFuShiJiaoJie.HuanZheQuXiang.Split('#')[1].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_HuanZheQuXiang_CCU"] = fd.MaZuiHuiFuShiJiaoJie.HuanZheQuXiang.Split('#')[2].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_HuanZheQuXiang_CSICU"] = fd.MaZuiHuiFuShiJiaoJie.HuanZheQuXiang.Split('#')[3].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_HuanZheQuXiang_MaZuiHuiFuShi"] = fd.MaZuiHuiFuShiJiaoJie.HuanZheQuXiang.Split('#')[4].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_HuanZheQuXiang_ZiDongChuYuan"] = fd.MaZuiHuiFuShiJiaoJie.HuanZheQuXiang.Split('#')[5].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_HuanZheQuXiang_SiWang"] = fd.MaZuiHuiFuShiJiaoJie.HuanZheQuXiang.Split('#')[6].Equals("1") ? theTrue : string.Empty;
                    newRow["MZHFS_HuanZheQuXiang_JiaoJieShiJian"] = fd.MaZuiHuiFuShiJiaoJie.JiaoJieShiJian;
                    newRow["MZHFS_HuanZheQuXiang_JiaoBanHuShi"] = fd.MaZuiHuiFuShiJiaoJie.JiaoBanHuShi;
                    newRow["MZHFS_HuanZheQuXiang_JieBanHuShi"] = fd.MaZuiHuiFuShiJiaoJie.JieBanHuShi;
                    //ID隐藏，双击触发事件
                    newRow["Id"] = record.Id;
                    #endregion
                    dt.Rows.Add(newRow);
                }
            }
            gridControl1.DataSource = dt;
        }

        private void SetBandGridView()
        {
            StatDate.DateTime = DateTime.Now.AddDays(-30).Date;
            EndDate.DateTime = DateTime.Now;
            foreach (GridBand gridBand in this.bandedGridView1.Bands)//设置居中
            {
                foreach (GridBand gridBandSecond in gridBand.Children)
                {
                    gridBandSecond.OptionsBand.FixedWidth = true;
                    gridBandSecond.AppearanceHeader.Options.UseTextOptions = true;
                    gridBandSecond.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
                    gridBandSecond.AppearanceHeader.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
                }
                gridBand.OptionsBand.FixedWidth = true;
                gridBand.AppearanceHeader.Options.UseTextOptions = true;
                gridBand.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
                gridBand.AppearanceHeader.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
            }
        }

        #region 查询
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            BindInfo();
        }
        #endregion

        #region 增加
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            AddSurgery addForm = new AddSurgery(LoginUser, Patientinfo, string.Empty);
            addForm.ShowDialog();
            if (addForm.DialogResult == DialogResult.OK)
            {
                BindInfo();
            }
        }
        #endregion

        #region 修改
        private void simpleButton3_Click(object sender, EventArgs e)
        {
            if (bandedGridView1.RowCount <= 0) return;
            string Id = bandedGridView1.GetRowCellValue(bandedGridView1.FocusedRowHandle, "Id").ToString();
            AddSurgery addForm = new AddSurgery(LoginUser, Patientinfo, Id);
            addForm.ShowDialog();
            if (addForm.DialogResult != DialogResult.OK) return;
            BindInfo();
        }
        #endregion

        #region 打印
        private void simpleButton4_Click(object sender, EventArgs e)
        {
            //单张打印
            //SurgeryPrint f = new SurgeryPrint(patientId, Convert.ToInt32(visit), (int)FormType.SheetSafeChkRecord);
            //多张打印
            SurgeryPrints f = new SurgeryPrints(Patientinfo,StatDate.DateTime, EndDate.DateTime);
            f.Show();
        }
        #endregion

        #region 删除
        private void simpleButton5_Click(object sender, EventArgs e)
        {
            if (bandedGridView1.RowCount <= 0) return;
            if (MessageBox.Show("确定要删除数据吗？", "删除前确认", MessageBoxButtons.OKCancel) != DialogResult.OK) return;
            string id = bandedGridView1.GetRowCellValue(bandedGridView1.FocusedRowHandle, "Id").ToString();
            var ret2 = formService.DeleteNursingFormRecord(id);
            MessageBox.Show(ret2.M);
            if (ret2.Code != 1) return;
            BindInfo();
        }
        #endregion
        private void bandedGridView1_DoubleClick(object sender, EventArgs e)
        {
            if (bandedGridView1.RowCount <= 0) return;
            string Id = bandedGridView1.GetRowCellValue(bandedGridView1.FocusedRowHandle, "Id").ToString();
            AddSurgery addForm = new AddSurgery(LoginUser, Patientinfo, Id);
            addForm.ShowDialog();
            if (addForm.DialogResult != DialogResult.OK) return;
            BindInfo();
        }
    }
}
